package com.aspose.cells;

import java.awt.geom.AffineTransform;
import java.awt.geom.PathIterator;

class zadc {
   public static com.aspose.cells.a.d.zn a(com.aspose.cells.b.a.b.a.ze var0, ze var1) {
      PathIterator var2 = var0.getPathIterator((AffineTransform)null);
      return a(var2, var1);
   }

   public static com.aspose.cells.a.d.zn a(com.aspose.cells.b.a.b.zr var0, ze var1) {
      PathIterator var2 = var0.getPathIterator((AffineTransform)null);
      return a(var2, var1);
   }

   public static com.aspose.cells.a.d.zn a(PathIterator var0, ze var1) {
      double var6 = 0.0D;
      double var8 = 0.0D;
      double var10 = 0.0D;
      double var12 = 0.0D;
      com.aspose.cells.a.d.zn var14 = null;
      com.aspose.cells.a.d.zo var15 = null;
      float var16 = 1.0F;

      try {
         var14 = new com.aspose.cells.a.d.zn();
         double[] var17 = new double[6];
         double var2 = 0.0D;
         double var4 = 0.0D;
         int var18 = 0;
         com.aspose.cells.b.a.b.zo[] var19 = new com.aspose.cells.b.a.b.zo[4];
         var10 = 0.0D;

         for(var12 = 0.0D; !var0.isDone(); var0.next()) {
            int var20 = var0.currentSegment(var17);

            for(int var21 = 0; var21 < var17.length; ++var21) {
               var17[var21] = (double)var1.b((float)var17[var21]);
            }

            switch(var20) {
            case 0:
               if (var18 > 0) {
                  a(var15, new com.aspose.cells.b.a.b.zo(var10, var12), var19, var18, (double)var16);
                  var18 = 0;
               }

               var15 = new com.aspose.cells.a.d.zo();
               var15.a(false);
               var14.a((com.aspose.cells.a.d.zl)var15);
               var6 = var17[0];
               var8 = var17[1];
               var15.a(new com.aspose.cells.b.a.b.zo(var6 * (double)var16, var8 * (double)var16));
               var10 = var17[0];
               var12 = var17[1];
               var2 = var17[0];
               var4 = var17[1];
               break;
            case 1:
               var19 = a(var19, var18++, (float)var17[0], (float)var17[1]);
               var2 = var17[0];
               var4 = var17[1];
               break;
            case 2:
               if (var18 > 0) {
                  a(var15, new com.aspose.cells.b.a.b.zo(var10, var12), var19, var18, (double)var16);
               }

               var18 = 0;
               double var41 = var17[0];
               double var23 = var17[1];
               double var25 = var17[2];
               double var27 = var17[3];
               double var29 = var41 + (var2 - var41) / 3.0D;
               double var31 = var23 + (var4 - var23) / 3.0D;
               double var33 = var41 + (var25 - var41) / 3.0D;
               double var35 = var23 + (var27 - var23) / 3.0D;
               com.aspose.cells.a.d.zt var37 = new com.aspose.cells.a.d.zt();
               var37.a(new com.aspose.cells.b.a.b.zo(var2 * (double)var16, var4 * (double)var16));
               var37.b(new com.aspose.cells.b.a.b.zo(var29 * (double)var16, var31 * (double)var16));
               var37.c(new com.aspose.cells.b.a.b.zo(var33 * (double)var16, var35 * (double)var16));
               var37.d(new com.aspose.cells.b.a.b.zo(var25 * (double)var16, var27 * (double)var16));
               com.aspose.cells.a.d.zp var38 = new com.aspose.cells.a.d.zp();
               var38.a(var37);
               var15.a((com.aspose.cells.a.d.zl)var38);
               var2 = var25;
               var4 = var27;
               var10 = var25;
               var12 = var27;
               break;
            case 3:
               if (var18 > 0) {
                  a(var15, new com.aspose.cells.b.a.b.zo(var10, var12), var19, var18, (double)var16);
               }

               var18 = 0;
               com.aspose.cells.a.d.zt var40 = new com.aspose.cells.a.d.zt();
               var40.a(new com.aspose.cells.b.a.b.zo(var2 * (double)var16, var4 * (double)var16));
               var40.b(new com.aspose.cells.b.a.b.zo(var17[0] * (double)var16, var17[1] * (double)var16));
               var40.c(new com.aspose.cells.b.a.b.zo(var17[2] * (double)var16, var17[3] * (double)var16));
               var40.d(new com.aspose.cells.b.a.b.zo(var17[4] * (double)var16, var17[5] * (double)var16));
               com.aspose.cells.a.d.zp var22 = new com.aspose.cells.a.d.zp();
               var22.a(var40);
               var15.a((com.aspose.cells.a.d.zl)var22);
               var2 = var17[4];
               var4 = var17[5];
               var10 = var2;
               var12 = var4;
               break;
            case 4:
               if (var18 > 0) {
                  a(var15, new com.aspose.cells.b.a.b.zo(var10, var12), var19, var18, (double)var16);
               }

               var15.a(true);
               var2 = var6;
               var4 = var8;
               var18 = 0;
            }
         }

         if (var18 > 0) {
            a(var15, new com.aspose.cells.b.a.b.zo(var10, var12), var19, var18, (double)var16);
         }
      } catch (Exception var39) {
         com.aspose.cells.a.e.zf.a((Throwable)var39);
      }

      return var14;
   }

   private static com.aspose.cells.b.a.b.zo[] a(com.aspose.cells.b.a.b.zo[] var0, int var1, float var2, float var3) {
      com.aspose.cells.b.a.b.zo[] var4 = null;
      if (var1 >= var0.length) {
         var4 = new com.aspose.cells.b.a.b.zo[var1 << 1];
         System.arraycopy(var0, 0, var4, 0, var0.length);
      } else {
         var4 = var0;
      }

      if (var4[var1] == null) {
         var4[var1] = new com.aspose.cells.b.a.b.zo(var2, var3);
      } else {
         var4[var1].a(var2);
         var4[var1].b(var3);
      }

      return var4;
   }

   private static void a(com.aspose.cells.a.d.zo var0, com.aspose.cells.b.a.b.zo var1, com.aspose.cells.b.a.b.zo[] var2, int var3, double var4) throws Exception {
      com.aspose.cells.b.a.b.zo[] var6 = new com.aspose.cells.b.a.b.zo[var3 + 1];
      var6[0] = new com.aspose.cells.b.a.b.zo((double)var1.d() * var4, (double)var1.e() * var4);

      for(int var7 = 1; var7 <= var3; ++var7) {
         var6[var7] = new com.aspose.cells.b.a.b.zo((double)var2[var7 - 1].d() * var4, (double)var2[var7 - 1].e() * var4);
      }

      float[] var9 = new float[var6.length * 2];

      for(int var8 = 0; var8 < var6.length; ++var8) {
         var9[var8 * 2] = var6[var8].d();
         var9[var8 * 2 + 1] = var6[var8].e();
      }

      com.aspose.cells.a.d.zq var10 = new com.aspose.cells.a.d.zq(var9);
      var0.a((com.aspose.cells.a.d.zl)var10);
   }
}
